package cn.gyx.hrm.service.impl;

import cn.gyx.hrm.constants.BaseConstants;
import cn.gyx.hrm.domain.Meal;
import cn.gyx.hrm.mapper.MealMapper;
import cn.gyx.hrm.service.IMealService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.netflix.discovery.converters.Auto;
import org.apache.commons.lang.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 套餐表 服务实现类
 * </p>
 *
 * @author gyx
 * @since 2021-11-22
 */
@Service
public class MealServiceImpl extends ServiceImpl<MealMapper, Meal> implements IMealService {

    @Autowired
    private MealMapper mealMapper;

    @Override
    public void saveCombo(Long mealId, Long loginId) {
        // 限定使用时间
        Date time = DateUtils.addMinutes(new Date(),1 );

        mealMapper.saveCombo(mealId,loginId,time,BaseConstants.Meal.STATE_UNPAID);
    }
}
